package com.example.adpter;

import java.util.List;







import com.example.rod.Musisc;
import com.example.roid.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MusicAdapter extends BaseAdapter{
	private  List<Musisc> mMusisc;
	private Context context;
	
	public MusicAdapter(List<Musisc> mMusisc, Context context) {
		super();
		this.mMusisc = mMusisc;
		this.context = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mMusisc.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mMusisc.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	public List<Musisc>  getALL(){
		return mMusisc;
		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder=null;
		
		if(convertView==null){
			viewHolder=new ViewHolder();
			convertView = LayoutInflater.from(context)
					.inflate(R.layout.music_main,parent,false);
			viewHolder.textView =  (TextView) convertView
					.findViewById(R.id.asd);
			convertView.setTag(viewHolder);
		}else{
			viewHolder = (ViewHolder) convertView.getTag();
		}
		Musisc news =(Musisc) getItem(position);
		viewHolder.textView.setText(news.getName());
		return convertView;
	}
	
	private class ViewHolder{
		private TextView textView;
	}
	

}
